################################################################################### 
## 
## Hack Title:    Add new field to profile
## Hack Version:  1.2.1
## optional Part: Dropdown menu instead of input field 1.0.2
## Author         Acid
## Support:	  http://www.phpbbhacks.com/forums
##
## Description:   If you want to have a predefined dropdown menu instead of an
##		  input field..
##		  If youve added more than one field duplicate the following
##		  steps and change "music" (be aware of the spelling).
##
## Required:      addfield_english.txt
##
## Files to edit: 5
##		  language/lang_english/lang_main.php
##		  admin/admin_users.php
##		  includes/usercp_register.php
##                templates/xxx/admin/user_edit_body.tpl
##                templates/xxx/profile_add_body.tpl
##
################################################################################### 
## 
## Installation/Author Notes: 
## First always backup the files that you're going to edit. 
## 
################################################################################### 
##
## Versions:
##
## 1.0.2 - typo in $lang['Music_choice'] (lang_main.php) fixed
## 1.0.1 - guide for admin_users.php/user_edit_body.tpl added
## 1.0   - optional part added
##
################################################################################### 
# 
#-----[ OPEN ]------------------------------------------
# templates/lang_english/lang_main.php
# 
#-----[ FIND (if already added) ]---------------------------------------------------
# 
$lang['Music'] = 'Music';

# 
#-----[ AFTER ADD ]---------------------------------------------------
# 
## if youre going to edit the part do not delete the single quotes (') and 
## the first entry (empty). you may change "empty" of course.

$lang['Music_choice'] = array('(empty)','Techno','Pop','Funk','Rock','Beat','RockSteady','Classic');



# 
#-----[ OPEN ]------------------------------------------
#  
# includes/usercp_register.php
# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
# 
#-----[ ADD BEFORE ]---------------------------------------------------
# 
               		$music = ($music == $lang['Music_choice']['0']) ? '' : $music;

# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "INSERT INTO " . USERS_TABLE . "
# 
#-----[ ADD BEFORE ]---------------------------------------------------
# 
               		$music = ($music == $lang['Music_choice']['0']) ? '' : $music;

# 
#-----[ FIND ]---------------------------------------------------
# 
	$template->set_filenames(array(
		'body' => 'profile_add_body.tpl')
	);

# 
#-----[ ADD BELOW ]---------------------------------------------------
# 
	$s_music = '<select name="music">';
	for($i = 0; $i < count($lang['Music_choice']); $i++ )
	{
	        $s_music .= '<option value="' . $lang['Music_choice'][$i] . '">' . $lang['Music_choice'][$i]. '</option>';
	}
	$s_music .= '</select>'; 
	$s_music = str_replace("value=\"".$music."\">", "value=\"".$music."\" SELECTED>" ,$s_music);


# 
#-----[ FIND ]---------------------------------------------------
# 
		'MUSIC' => $music,
# 
#-----[ REPLACE WITH (if already added) ]---------------------------------------------------
# 
		'S_MUSIC' => $s_music,



# 
#-----[ OPEN ]------------------------------------------
#  
# admin/admin_users.php
# 
#-----[ FIND (just a quote) ]---------------------------------------------------
# 
			$sql = "UPDATE " . USERS_TABLE . "
# 
#-----[ ADD BEFORE ]---------------------------------------------------
# 
               		$music = ($music == $lang['Music_choice']['0']) ? '' : $music;

# 
#-----[ FIND ]---------------------------------------------------
# 
		$template->set_filenames(array(
			"body" => "admin/user_edit_body.tpl")
		);

# 
#-----[ ADD BELOW ]---------------------------------------------------
# 
		$s_music = '<select name="music">';
		for($i = 0; $i < count($lang['Music_choice']); $i++ )
		{
		        $s_music .= '<option value="' . $lang['Music_choice'][$i] . '">' . $lang['Music_choice'][$i]. '</option>';
		}
		$s_music .= '</select>'; 
		$s_music = str_replace("value=\"".$music."\">", "value=\"".$music."\" SELECTED>" ,$s_music);


# 
#-----[ FIND ]---------------------------------------------------
# 
			'MUSIC' => $music, 
# 
#-----[ REPLACE WITH (if already added) ]---------------------------------------------------
# 
			'S_MUSIC' => $s_music, 



# 
#-----[ OPEN ]------------------------------------------
#  
# templates/xxx/profile_add_body.tpl
# 
#-----[ FIND ]---------------------------------------------------
# 
          <td class="row2"> <input class="post" type="text" name="music" size="35" maxlength="50" value="{MUSIC}" /> /td> 
# 
#-----[ REPLACE WITH (if already added) ]---------------------------------------------------
# 
	  <td class="row2"> {S_MUSIC}  </td>



# 
#-----[ OPEN ]------------------------------------------
#  
# templates/xxx/admin/user_edit_body.tpl
# 
#-----[ FIND ]---------------------------------------------------
# 
          <td class="row2"> <input class="post" type="text" name="music" size="35" maxlength="50" value="{MUSIC}" /> /td> 
# 
#-----[ REPLACE WITH (if already added) ]---------------------------------------------------
# 
	  <td class="row2"> {S_MUSIC}  </td>

################################################################################### 
################################################################################### 
###################################################################################